close all; clear; clc;

g = 9.80665; l = 1;

A = [0, 1, 0, 0;
    0, 0, 0, 0;
    0,0, 0, 1;
    0, 0, g / l, 0];
B = [0; 1; 0; 1 / l];
C = [1, 0, 0, 0;
    0, 1, 0, 0;
    0, 0, 1, 0;
    0, 0, 0, 1];
D = [0; 0; 0; 0];

Q = [1, 0, 0, 0;
    0, 1, 0, 0;
    0, 0, 1, 0;
    0, 0, 0, 1];
R = [1];

K = lqr(A, B, Q, R);

simOut = sim('sim_kin');